import csv
import matplotlib.pyplot as plt 
import numpy as np

with open('result_B.csv', encoding='utf-8') as f:
    reader = csv.reader(f)
    print(type(reader))
    for row in reader:
       print('**************************************************************************')
       print(row[2])
       a=row[2].split(',')
       a[0]=a[0].split('[')
       b=np.zeros(7)
       #a=[868.1799999999997, 404.20000000000005, 3622.490000000003, 3466.139999999999, 3194.340000000002, 3172.7200000000007, 2893.0900000000006, 3465.820000000002, 3544.1800000000026, 4612.980000000003, 3087.16, 3037.940000000001, 1102.9599999999996, 1154.6299999999999, 1184.45, 3638.440000000002, 4666.470000000004, 3549.0100000000016]
       
       for i in range(18):
           if i!=0:
               a[i]=float(a[i])
       b[0]=float(a[0][1])+a[1]+a[2]
       b[1]=a[3]+a[4]+a[5]
       b[2]=a[6]+a[7]+a[8]
       b[3]=a[9]+a[10]+a[11]
       
       x = np.linspace(0, 12, 12)
       plt.plot(x[0:4], b[0:4],marker='*')
       #plt.plot(x[0:12],a[0:12],marker='*')
        #x = np.linspace(12, 19, 7)
       b[4]=a[12]+a[13]+a[14]
       b[5]=a[15]+a[16]+a[17]
       #b[6]=sum(a[18],a[19],a[8])
       plt.plot(x[0:2], b[4:6],marker='o')
       c=[4917.922610313302, 5099.472909950378, 5165.8178436915005, 5350.2003127200305, 5413.7130770696995, 5600.927715489684, 5661.608310447898, 5851.655118259336, 5909.503543826096, 6102.382521028988, 6157.398777204295, 6353.109923798641]
       #plt.plot(x, c,marker='*')
       plt.show()

'''
[2130.0, 360.0, 5274.0, 4514.15, 5635.0, 5124.0, 5870.0, 5645.0, 5090.0, 6045.0, 3854.0, 4155.0, 1414.0, 1875.0, 1713.0, 5400.0, 7916.0, 4784.0, 0]
[25.0, 0, 275.0, 398.0, 430.0, 490.0, 427.0, 360.0, 365.0, 260.0, 150.0, 45.0, 20.0, 30.0, 50.0, 702.0, 815.0, 473.5, 0]
[65.0, 80.0, 549.0, 273.0, 363.0, 275.0, 440.0, 1157.0, 390.0, 444.0, 870.0, 570.0, 1195.0, 285.0, 435.0, 1651.0, 1289.0, 1662.0, 0]
'''